//
//  WYHttpServer+WYRedPacket.m
//  Boss
//
//  Created by admin on 2018/6/11.
//  Copyright © 2018年 admin. All rights reserved.
//

#import "WYHttpServer+WYRedPacket.h"
#import "NSString+Extension.h"
@implementation WYHttpServer (WYRedPacket)
+(void)getRedPacketCountSucessBlock:(void(^)(BOOL success,id response,NSString *errorMessage))completion
{
    
    AFHTTPSessionManager *manager=[[WYHttpServer sharedInstance] requestManager];
    NSMutableDictionary *parm=[[WYHttpServer sharedInstance] requestParameters];
    [[WYHttpServer sharedInstance] postOperationWithManger:manager Url:kUrlGetReceiveRedPacketTimes WithPara:parm Success:^(BOOL success, id response, NSString *errorMsg) {
        completion(success,response,errorMsg);
    }];
}

+(void)sendRedPacketWithImages:(NSArray *)images WithContent:(NSString *)content WithOutLink:(NSString *)outLink WithMoney:(NSString *)money WithNumber:(NSString *)number WithType:(NSNumber *)type WithScope:(NSNumber *)scope WithAccurateType:(NSNumber *)accurateType WithCoordinate:(NSString *)coordinate WithProvince:(NSString *)province WithCity:(NSString *)city WithCountry:(NSString *)county WithAddress:(NSString *)address WithPayType:(NSString *)payType WithHideLoc:(NSNumber *)hideLoc WithVipLevel:(NSString *)vipLevel SucessBlock:(void(^)(BOOL success,id response,NSString *errorMessage))completion
{
    
    AFHTTPSessionManager *manager=[[WYHttpServer sharedInstance] requestManager];
    NSMutableDictionary *parm=[[WYHttpServer sharedInstance] requestParameters];
    [parm setValue: [NSString arrayToJSONString:images] forKey:@"images"];
    [parm setValue:content forKey:@"content"];
    [parm setValue:outLink forKey:@"outLink"];
    [parm setValue:money forKey:@"money"];
    [parm setValue:number forKey:@"number"];
    [parm setValue:type forKey:@"type"];
    [parm setValue:scope forKey:@"scope"];
    [parm setValue:accurateType forKey:@"accurateType"];
    [parm setValue:coordinate forKey:@"coordinate"];
    [parm setValue:province forKey:@"province"];
    [parm setValue:city forKey:@"city"];
    [parm setValue:county forKey:@"county"];
    [parm setValue:address forKey:@"address"];
    [parm setValue:payType forKey:@"payType"];
    [parm setValue:hideLoc forKey:@"hideLoc"];
    [parm setValue:vipLevel forKey:@"vipLevel"];
    
    [[WYHttpServer sharedInstance] postOperationWithManger:manager Url:kUrlCreateRedPacket WithPara:parm Success:^(BOOL success, id response, NSString *errorMsg) {
        completion(success,response,errorMsg);
    }];
    
    
    
    
    
    
    
}

/**
 * 获取附近红包接口
 */

+(void)getNearRedPacketWithCoordinate:(NSString *)coordinate WithProvince:(NSString *)province WithCity:(NSString *)city WithCountry:(NSString *)country SucessBlock:(void(^)(BOOL success,id response,NSString *errorMessage))completion
{
    AFHTTPSessionManager *manager=[[WYHttpServer sharedInstance] requestManager];
    NSMutableDictionary *parm=[[WYHttpServer sharedInstance] requestParameters];
    [parm setValue:coordinate forKey:@"coordinate"];
    [parm setValue:province forKey:@"province"];
    [parm setValue:city forKey:@"city"];
    [parm setValue:country forKey:@"county"];
    [[WYHttpServer sharedInstance] postOperationWithManger:manager Url:kUrlRedpacketNearby WithPara:parm Success:^(BOOL success, id response, NSString *errorMsg) {
        completion(success,response,errorMsg);
    }];
    
    
    
    
    
    
}

+(void)receiveRedPacketWithCoordinate:(NSString *)coordinate WithRedpacketId:(NSString *)redpacketId WithRedpacketType:(NSString *)redpacketType SucessBlock:(void(^)(BOOL success,id response,NSString *errorMessage))completion
{
    AFHTTPSessionManager *manager=[[WYHttpServer sharedInstance] requestManager];
    NSMutableDictionary *parm=[[WYHttpServer sharedInstance] requestParameters];
    [parm setValue:coordinate forKey:@"coordinate"];
    [parm setValue:redpacketId forKey:@"redpacketId"];
    [parm setValue:redpacketType forKey:@"redpacketType"];
    [[WYHttpServer sharedInstance] postOperationWithManger:manager Url:kUrlRedpacketReceive WithPara:parm Success:^(BOOL success, id response, NSString *errorMsg) {
        completion(success,response,errorMsg);
    }];
}

+(void)getRedPacketInfoWithRedpacketId:(NSString *)redpacketId WithRedpacketType:(NSString *)redpacketType SucessBlock:(void(^)(BOOL success,id response,NSString *errorMessage))completion
{
    AFHTTPSessionManager *manager=[[WYHttpServer sharedInstance] requestManager];
    NSMutableDictionary *parm=[[WYHttpServer sharedInstance] requestParameters];
  //  [parm setValue:coordinate forKey:@"coordinate"];
    [parm setValue:redpacketId forKey:@"redpacketId"];
    [parm setValue:redpacketType forKey:@"redpacketType"];
    [[WYHttpServer sharedInstance] postOperationWithManger:manager Url:kUrlRedpacketInfo WithPara:parm Success:^(BOOL success, id response, NSString *errorMsg) {
        completion(success,response,errorMsg);
    }];
}

+(void)getRedPacketCommentList:(NSString *)messageId WithCurrentPage:(NSString *)currentPage WithRedpacketType:(NSString *)redpacketType SucessBlock:(void(^)(BOOL success,id response,NSString *errorMessage))completion
{
    
    AFHTTPSessionManager *manager=[[WYHttpServer sharedInstance] requestManager];
    NSMutableDictionary *parm=[[WYHttpServer sharedInstance] requestParameters];
    [parm setValue:currentPage forKey:@"currentPage"];
    [parm setValue:messageId forKey:@"messageId"];
    [parm setValue:redpacketType forKey:@"redpacketType"];
    [[WYHttpServer sharedInstance] postOperationWithManger:manager Url:kUrlRedpacketCommentList WithPara:parm Success:^(BOOL success, id response, NSString *errorMsg) {
        completion(success,response,errorMsg);
    }];
    
    
    
    
    
    
}

+(void)sendRedPacketCommentWithMessageID:(NSString *)messageId WithContent:(NSString *)content WithRedpacketType:(NSString *)redpacketType SucessBlock:(void(^)(BOOL success,id response,NSString *errorMessage))completion
{
    AFHTTPSessionManager *manager=[[WYHttpServer sharedInstance] requestManager];
    NSMutableDictionary *parm=[[WYHttpServer sharedInstance] requestParameters];
    [parm setValue:content forKey:@"content"];
    [parm setValue:messageId forKey:@"messageId"];
    [parm setValue:redpacketType forKey:@"redpacketType"];
    [[WYHttpServer sharedInstance] postOperationWithManger:manager Url:kUrlRedpacketSendComment WithPara:parm Success:^(BOOL success, id response, NSString *errorMsg) {
        completion(success,response,errorMsg);
    }];
}

+(void)DeleteRedPacketCommentWithCommentId:(NSString *)commentId WithRedpacketType:(NSString *)redpacketType SucessBlock:(void(^)(BOOL success,id response,NSString *errorMessage))completion
{
    AFHTTPSessionManager *manager=[[WYHttpServer sharedInstance] requestManager];
    NSMutableDictionary *parm=[[WYHttpServer sharedInstance] requestParameters];
    [parm setValue:commentId forKey:@"commentId"];
    [parm setValue:redpacketType forKey:@"redpacketType"];
    [[WYHttpServer sharedInstance] postOperationWithManger:manager Url:kUrlRedpacketDeleteComment WithPara:parm Success:^(BOOL success, id response, NSString *errorMsg) {
        completion(success,response,errorMsg);
    }];
}


+(void)getRedPacketReceiveListWithRedpacketId:(NSString *)redpacketId WithCurrentPage:(NSString *)currentPage WithRedpacketType:(NSString *)redpacketType SucessBlock:(void(^)(BOOL success,id response,NSString *errorMessage))completion
{
    
    AFHTTPSessionManager *manager=[[WYHttpServer sharedInstance] requestManager];
    NSMutableDictionary *parm=[[WYHttpServer sharedInstance] requestParameters];
    [parm setValue:currentPage forKey:@"currentPage"];
    [parm setValue:redpacketId forKey:@"redpacketId"];
    [parm setValue:redpacketType forKey:@"redpacketType"];
    [[WYHttpServer sharedInstance] postOperationWithManger:manager Url:kUrlRedpacketReceiveList WithPara:parm Success:^(BOOL success, id response, NSString *errorMsg) {
        completion(success,response,errorMsg);
    }];
}
/**
 * 我领取的红包接口
 */

+(void)getRedPacketMyReceiveWithYear:(NSString *)year SucessBlock:(void(^)(BOOL success,id response,NSString *errorMessage))completion
{
    
    AFHTTPSessionManager *manager=[[WYHttpServer sharedInstance] requestManager];
    NSMutableDictionary *parm=[[WYHttpServer sharedInstance] requestParameters];
    [parm setValue:year forKey:@"year"];
    [[WYHttpServer sharedInstance] postOperationWithManger:manager Url:kUrlRedpacketMyReceive WithPara:parm Success:^(BOOL success, id response, NSString *errorMsg) {
        completion(success,response,errorMsg);
    }];
    
    
    
    
    
    
    
    
}

/**
 * 我领取的红包记录接口
 */
+(void)getRedPacketMyReceiveRecordWithYear:(NSString *)year WithCurrentPage:(NSString* )currentPage SucessBlock:(void(^)(BOOL success,id response,NSString *errorMessage))completion
{
    AFHTTPSessionManager *manager=[[WYHttpServer sharedInstance] requestManager];
    NSMutableDictionary *parm=[[WYHttpServer sharedInstance] requestParameters];
    [parm setValue:year forKey:@"year"];
    [parm setValue:currentPage forKey:@"currentPage"];
    [[WYHttpServer sharedInstance] postOperationWithManger:manager Url:kUrlRedpacketMyReceiveRecord WithPara:parm Success:^(BOOL success, id response, NSString *errorMsg) {
        completion(success,response,errorMsg);
    }];
}

/**
 * 我发出的红包接口
 */
+(void)getRedPacketMySendWithYear:(NSString *)year SucessBlock:(void(^)(BOOL success,id response,NSString *errorMessage))completion
{
    AFHTTPSessionManager *manager=[[WYHttpServer sharedInstance] requestManager];
    NSMutableDictionary *parm=[[WYHttpServer sharedInstance] requestParameters];
    [parm setValue:year forKey:@"year"];
    [[WYHttpServer sharedInstance] postOperationWithManger:manager Url:kUrlRedpacketMySend WithPara:parm Success:^(BOOL success, id response, NSString *errorMsg) {
        completion(success,response,errorMsg);
    }];
}
/**
 * 我发出的红包记录接口
 */
+(void)getRedPacketMySendRecordWithYear:(NSString *)year WithCurrentPage:(NSString *)currentPage SucessBlock:(void(^)(BOOL success,id response,NSString *errorMessage))completion
{
    
    AFHTTPSessionManager *manager=[[WYHttpServer sharedInstance] requestManager];
    NSMutableDictionary *parm=[[WYHttpServer sharedInstance] requestParameters];
    [parm setValue:year forKey:@"year"];
    [parm setValue:currentPage forKey:@"currentPage"];
    [[WYHttpServer sharedInstance] postOperationWithManger:manager Url:kUrlRedpacketMySendRecord WithPara:parm Success:^(BOOL success, id response, NSString *errorMsg) {
        completion(success,response,errorMsg);
    }];
    
    
}
/**
 *专属红包信息
 */
+(void)getExclusivePacketSucessBlock:(void(^)(BOOL success,id response,NSString *errorMessage))completion
{
    AFHTTPSessionManager *manager=[[WYHttpServer sharedInstance] requestManager];
    NSMutableDictionary *parm=[[WYHttpServer sharedInstance] requestParameters];
    [[WYHttpServer sharedInstance] postOperationWithManger:manager Url:kUrlRedpacketExclusivePacket WithPara:parm Success:^(BOOL success, id response, NSString *errorMsg) {
        completion(success,response,errorMsg);
    }];
    
    
    
}


/**
 *查询推荐红包
 */
+(void)getSharePacketListSucessBlock:(void(^)(BOOL success,id response,NSString *errorMessage))completion
{
    AFHTTPSessionManager *manager=[[WYHttpServer sharedInstance] requestManager];
    NSMutableDictionary *parm=[[WYHttpServer sharedInstance] requestParameters];
    [[WYHttpServer sharedInstance] postOperationWithManger:manager Url:kUrlCreateSharePacketList WithPara:parm Success:^(BOOL success, id response, NSString *errorMsg) {
        completion(success,response,errorMsg);
    }];
}
/**
 *领取推荐红包
 */
+(void)receiveSharePacketWithPacketId:(NSString *)packetId SucessBlock:(void(^)(BOOL success,id response,NSString *errorMessage))completion
{
    
    AFHTTPSessionManager *manager=[[WYHttpServer sharedInstance] requestManager];
    NSMutableDictionary *parm=[[WYHttpServer sharedInstance] requestParameters];
    [parm setValue:packetId forKey:@"packetId"];
    [[WYHttpServer sharedInstance] postOperationWithManger:manager Url:kUrlReceiveGetSharePacke WithPara:parm Success:^(BOOL success, id response, NSString *errorMsg) {
        completion(success,response,errorMsg);
    }];
    
    
}

/**
 *评论回复
 */
+(void)addRedPacketCommentReplayWithMessageId:(NSString *)messageId WithCommentId:(NSString *)commentId WithToReplayId:(NSString *)toReplyId WithContent:(NSString *)content WithToUserId:(NSString *)toUserId WithToUserName:(NSString *)toUserName WithRedPacketType:(NSString *)redpacketType SucessBlock:(void(^)(BOOL success,id response,NSString *errorMessage))completion
{
    
    AFHTTPSessionManager *manager=[[WYHttpServer sharedInstance] requestManager];
    NSMutableDictionary *parm=[[WYHttpServer sharedInstance] requestParameters];
    [parm setValue:messageId forKey:@"messageId"];
    [parm setValue:commentId forKey:@"commentId"];
    [parm setValue:toReplyId forKey:@"toReplyId"];
    [parm setValue:content forKey:@"content"];
    [parm setValue:toUserId forKey:@"toUserId"];
    [parm setValue:toUserName forKey:@"toUserName"];
    [parm setValue:redpacketType forKey:@"redpacketType"];
    [[WYHttpServer sharedInstance] postOperationWithManger:manager Url:kUrlRedpacketCommentReply WithPara:parm Success:^(BOOL success, id response, NSString *errorMsg) {
        completion(success,response,errorMsg);
    }];
    
}
/**
 *获取单个红包回复接口
 */
+(void)getCommentInfoWithCommentId:(NSString *)commentId WithRedpacketType:(NSString *)redpacketType SucessBlock:(void(^)(BOOL success,id response,NSString *errorMessage))completion
{
    AFHTTPSessionManager *manager=[[WYHttpServer sharedInstance] requestManager];
    NSMutableDictionary *parm=[[WYHttpServer sharedInstance] requestParameters];
 //   [parm setValue:messageId forKey:@"messageId"];
    [parm setValue:commentId forKey:@"commentId"];
//    [parm setValue:toReplyId forKey:@"toReplyId"];
//    [parm setValue:content forKey:@"content"];
//    [parm setValue:toUserId forKey:@"toUserId"];
//    [parm setValue:toUserName forKey:@"toUserName"];
    [parm setValue:redpacketType forKey:@"redpacketType"];
    [[WYHttpServer sharedInstance] postOperationWithManger:manager Url:kUrlRedpacketCommentInfo WithPara:parm Success:^(BOOL success, id response, NSString *errorMsg) {
        completion(success,response,errorMsg);
    }];
    
    
}
/**
 * 回复列表
 */
+(void)getCommentReplyList:(NSString *)currentPage WithCommentID:(NSString *)commentId WithRedPacketType:(NSString *)redPacketType SucessBlock:(void(^)(BOOL success,id response,NSString *errorMessage))completion
{
    AFHTTPSessionManager *manager=[[WYHttpServer sharedInstance] requestManager];
    NSMutableDictionary *parm=[[WYHttpServer sharedInstance] requestParameters];
    //   [parm setValue:messageId forKey:@"messageId"];
    [parm setValue:commentId forKey:@"commentId"];
    //    [parm setValue:toReplyId forKey:@"toReplyId"];
    //    [parm setValue:content forKey:@"content"];
    //    [parm setValue:toUserId forKey:@"toUserId"];
    //    [parm setValue:toUserName forKey:@"toUserName"];
    [parm setValue:redPacketType forKey:@"redpacketType"];
    [parm setValue:currentPage forKey:@"currentPage"];
    [[WYHttpServer sharedInstance] postOperationWithManger:manager Url:kUrlRedpacketCommentReplyList WithPara:parm Success:^(BOOL success, id response, NSString *errorMsg) {
        completion(success,response,errorMsg);
    }];
}

+(void)deleteCommnetReplyWithReplyId:(NSString *)replyId WithRedpacketType:(NSString *)redpacketType SucessBlock:(void(^)(BOOL success,id response,NSString *errorMessage))completion
{
    
    AFHTTPSessionManager *manager=[[WYHttpServer sharedInstance] requestManager];
    NSMutableDictionary *parm=[[WYHttpServer sharedInstance] requestParameters];
    //   [parm setValue:messageId forKey:@"messageId"];
    [parm setValue:replyId forKey:@"replyId"];
    //    [parm setValue:toReplyId forKey:@"toReplyId"];
    //    [parm setValue:content forKey:@"content"];
    //    [parm setValue:toUserId forKey:@"toUserId"];
    //    [parm setValue:toUserName forKey:@"toUserName"];
    [parm setValue:redpacketType forKey:@"redpacketType"];
    [[WYHttpServer sharedInstance] postOperationWithManger:manager Url:kUrlRedpacketDeleteCommentReply WithPara:parm Success:^(BOOL success, id response, NSString *errorMsg) {
        completion(success,response,errorMsg);
    }];
}



@end
